package org.example.mapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.example.pojo.Emp;

import java.lang.reflect.Array;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface EmpMapper {
    @Select("select * from emp where username = #{username} and password = #{password}")
    Emp login(Emp emp);

    List<Emp> list(String name, Short gender, LocalDate begin, LocalDate end);

    void delete(List ids);

    void add(Emp emp);

    @Select("select * from emp where id = #{id}")
    Emp getById(Integer id);

    @Update("update emp set image=#{image},username=#{username},name=#{name},gender=#{gender},job=#{job},entrydate=#{entrydate},dept_id=#{deptId},update_time=now() where id=#{id}" )
    void update(Emp emp);

    @Delete("delete from emp where dept_id = #{id}")
    void deleteByDeptId(Integer id);
}
